package com.meilian.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.print.attribute.standard.Sides;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
//用户实体类
@Data
@TableName("user")
public class User implements Serializable {
    private static final long serialVersionUID = -3468158747442271640L;
    @TableId(type = IdType.AUTO)
    @JsonProperty("user_id")//jackson的注解,用于属性的格式化
    private Integer userId;
    @Length(min = 6)
    private String userName;
    @NotBlank
    //忽略属性,不生成json,不接收json数据@JsonIgnore
    //@JsonInclude(JsonInclude.Include.NON_NULL) 当这个值不为null的时候生成json,为null不生成
    //不影响接收json
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String password;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotBlank
    private String userPhonenumber;
}
